package liurong.driver.Scheduled;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class ScheduledTest {
	private static final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(3);

	private static int flag = 0;

	public static void main(String[] args) {
		Thread thread = new Thread() {
			public void run() {
				System.out.println(++flag);
			}
		};
		thread.setName("liurong001");
		scheduledExecutorService.scheduleWithFixedDelay(thread, 2000, 2000, TimeUnit.MILLISECONDS);
	}
}
